package util;

public class Softkeys {

	public static int leftSoftKey = -6;
	public static int rightSoftKey = -7;

	static {
		Object[][] keyMaps = { { "Nokia", new Integer(-6), new Integer(-7) },
				{ "ricsson", new Integer(-6), new Integer(-7) },
				{ "iemens", new Integer(-1), new Integer(-4) },
				{ "otorola", new Integer(-21), new Integer(-22) },
				{ "harp", new Integer(-21), new Integer(-22) },
				{ "j2me", new Integer(-6), new Integer(-7) },
				{ "intent JTE", new Integer(57345), new Integer(57346) },
				{ "RIM", new Integer(-21), new Integer(27) } };

		String platform = null;
		String prop = System.getProperty("com.mot.carrier.URL");
		if (prop != null) {
			platform = "motorola";
		} else {
			try {
				Class.forName("com.motorola.graphics.j3d.Graphics3D");
				platform = "motorola";
			} catch (Throwable e) {
			}
		}

		if (platform == null) // ok its probably not a Motorola phone.
		{
			platform = System.getProperty("microedition.platform");
		}

		for (int i = 0; i < keyMaps.length; ++i) {
			String manufacturer = (String) keyMaps[i][0];

			if (platform.indexOf(manufacturer) != -1) {
				if (i == 1) {
					if (platform.indexOf("P900") != -1
							|| platform.indexOf("P908") != -1) {
						leftSoftKey = ((Integer) keyMaps[i][2]).intValue();
						rightSoftKey = ((Integer) keyMaps[i][1]).intValue();
					} else {
						leftSoftKey = ((Integer) keyMaps[i][1]).intValue();
						rightSoftKey = ((Integer) keyMaps[i][2]).intValue();
					}
				} else {
					leftSoftKey = ((Integer) keyMaps[i][1]).intValue();
					rightSoftKey = ((Integer) keyMaps[i][2]).intValue();
				}
				break;
			}
		}
	}
}
